package cn.qixin.passport.controller;

import cn.qixin.passport.service.IEmailService;
import cn.qixin.passport.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@Api(tags = "03. 邮箱验证模块")
@RequestMapping("/mail")
public class MailController {


    @Autowired
    private IEmailService emailService;
    @Autowired
    RedisTemplate<String, String> redisTemplate;

    @ApiOperation("获取验证码")
    @ApiOperationSupport(order = 100)
    @PostMapping("/code")
    public JsonResult<Void> sendEmail(String email) {
        log.debug("开始处理【获取验证码】的请求");
        emailService.sendEmail(email);//验证码
        return JsonResult.ok();
    }


}
